package org.linlinjava.litemall.wx.web;



import org.linlinjava.litemall.core.core.core.domain.R;
import org.linlinjava.litemall.db.domain.ReturnGoodsList;
import org.linlinjava.litemall.db.service.LitemallOrderTotalReturnHistoryService;
import org.linlinjava.litemall.db.dto.RentPartGoodsDto;
import org.linlinjava.litemall.wx.annotation.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 租借订单部分归还控制器
 */
@RequestMapping("/wx/rentOrderPart")
@RestController
public class WXRentOrderPartController {
    @Autowired
    private LitemallOrderTotalReturnHistoryService totalReturnHistoryService;

    /**
     * 获取租借订单部分归还列表
     * @param rentOrderId 租借订单id
     * @return 商品信息
     */
    @GetMapping("/getReturnGoodsList")
    public R<List<ReturnGoodsList>> getReturnGoodsList(Long rentOrderId){
        return R.ok(totalReturnHistoryService.getReturnGoodsListByOrderId(rentOrderId));
    }


    /**
     *  部分租借
     * @param partGoodsDto，部分图书借阅信息
     * @return
     */
    @PostMapping("/rentPartGoods")
    public R<Boolean> rentPartGoods( @RequestBody RentPartGoodsDto partGoodsDto){
        totalReturnHistoryService.rentPartGoods(partGoodsDto);
        return R.ok();
    }


}
